
mui.plusReady(function() {
	var state = app.getState();
	var uid = state.userid;
	var memberToken = state.memberToken;
	var paradata={
		uid:uid,
		memberToken:memberToken 
	}
	
	if(memberToken){
		mui.post(Apiurl+'index/token', paradata, function(data) {
			
		if(data==null){
			
		}else{
			app.setState({});
			if(data.status==201){
				plus.nativeUI.alert('登陆超时,请重新登录',function(){
					 var curr = plus.webview.currentWebview();
					 //alert(curr.id);
                     var wvs = plus.webview.all();
                    
                     plus.webview.open('/pages/login.html');  
                     //curr.back();
                     for (var i = 0, len = wvs.length; i < len; i++) {
                        //关闭除setting页面外的其他页面
                        if (wvs[i].getURL() == curr.getURL())
                            continue;
                        plus.webview.close(wvs[i]);
                     }
                    //plus.webview.open('../login.html');
					plus.webview.close(curr);
				});
				
			}else if(data.status==202){
				plus.nativeUI.alert('账号异常，请联系管理员',function(){
					 var curr = plus.webview.currentWebview();
					 //alert(curr.id);
                     var wvs = plus.webview.all();
                    
                     plus.webview.open('/pages/login.html');  
                     //curr.back();
                     for (var i = 0, len = wvs.length; i < len; i++) {
                        //关闭除setting页面外的其他页面
                        if (wvs[i].getURL() == curr.getURL())
                            continue;
                        plus.webview.close(wvs[i]);
                     }
                    //plus.webview.open('../login.html');
					plus.webview.close(curr);
				});
			}else if(data.status==203){
				plus.nativeUI.alert('账号已在其他设备登陆，请重新登陆',function(){
					 var curr = plus.webview.currentWebview();
					 //alert(curr.id);
                     var wvs = plus.webview.all();
                    
                     plus.webview.open('/pages/login.html');  
                     //curr.back();
                     for (var i = 0, len = wvs.length; i < len; i++) {
                        //关闭除setting页面外的其他页面
                        if (wvs[i].getURL() == curr.getURL())
                            continue;
                        plus.webview.close(wvs[i]);
                     }
                    //plus.webview.open('../login.html');
					plus.webview.close(curr);
				});
			}
			
			
		}
			
		}, 'json'); 
	}else{
		mui.openWindow({
                    url: '/pages/login.html',
                    id: 'login',
                    preload: true,
                    show: {
                        aniShow: 'pop-in'
                    },
                    styles: {
                        popGesture: 'hide'
                    },
                    waiting: {
                        autoShow: false
                    }
               });
        //plus.webview.close('main');     
		
	}
	
	
	
})

/*	*/
	

